package com.tsy.server.system.controller;

import com.tsy.server.common.Result;
import com.tsy.server.system.entity.Role;
import com.tsy.server.system.service.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 角色管理控制器
 */
@Api(tags = "角色管理接口", description = "包含角色创建、修改、删除、查询等功能")
@RestController
@RequestMapping("/role")
public class RoleController {

    @Autowired
    private RoleService roleService;

    /**
     * 获取所有角色
     * @return 角色列表
     */
    @GetMapping("/roles")
    @ApiOperation(value = "获取所有角色", notes = "获取所有角色信息")
    public Result<List<Role>> getRoles() {
        List<Role> roles = roleService.getRoles();
        return Result.success(roles);
    }

}